package org.game.obj;

public class GWObject {
	
	/**
	 * Table-based position on map
	 */
	protected int x, y;
	
	protected int width, height;
	
	protected int number;
	
	/**
	 * Number of player that controlls the unit
	 */
	protected int player;
	
	protected int maxLife;
	
	protected int actLife;
	
	protected int armor;
	
	protected boolean dead;
	
	public GWObject(int x, int y, int w, int h, int num) {
		this.x = x;
		this.y = y;
		width = w;
		height = h;
		number = num;
		
		dead = false;
	}
	
	public void damage(int dmg) {
		dmg -= dmg*armor/100;
		actLife -= dmg;
		if(actLife <= 0) dead = true;
	}
	
	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public int getWidth() {
		return width;
	}

	public int getHeight() {
		return height;
	}

	public int getActLife() {
		return actLife;
	}

	public int getPlayer() {
		return player;
	}
	
	public void setPlayer(int player) {
		this.player = player;
	}

	public int getArmor() {
		return armor;
	}

	public int getNumber() {
		return number;
	}
	
	public void setNumber(int number) {
		this.number = number;
	}
	
	public boolean isDead() {
		return dead;
	}
}
